 <#include "../../common/com.html"/> <@layout>

<!-- ace styles -->
<link rel="stylesheet" href="${ctx}/static/assets/css/ace.min.css" />
<link href='${ctx}/static/assets/css/select2.css' media='all'
	rel='stylesheet' type='text/css' />

<script src='${ctx}/static/assets/js/select2.min.js'
	type='text/javascript'></script>
<script src='${ctx}/static/assets/js/select2_locale_zh-CN.js'
	type='text/javascript'></script>
<script type="text/javascript">
	/**
	 * 新增
	 */
	function saveModel() {
		var wpsl=0;
		var cksl=0;
		 wpsl=$("#wpsl").val().trim();
		 cksl=$("#cksl").val().trim();
	
		if(parseInt( cksl) > parseInt( wpsl) ){
			alert("退货数量不能大于入库数量！");
			return ;
		}
		$("#wpsl").val(parseInt( wpsl)-parseInt( cksl));

		var url = '${ctx}/cpglRk/thsave';
	
		$('#form1').form('submit', {
			url : url,
			onSubmit : function() {
				return $(this).form('validate');
			},
			success : function(data) {
				if(data=="1"){
					alert("办理成功！");
					parent.window.location.href = ' ${ctx}/cpglRk';
				} else {
					alert("办理失败！");
				}
			}
		});

	}
</script>
<div class="page-content">
	<div class="row-fluid">
		<form class="form-horizontal" id="form1" method="post">
			<div class="span12">
				<input type="hidden" name="id" id="id" value="${(rkid)!}"> 
			
				<div class="control-group">
					<label class="control-label">入库数量:</label>
					<div class="controls">
					<#list newlist as m>
						<input id="wpsl" name="wpsl" type="text" style="min-height: 24px;"  value="${(m.wpsl)!}" readonly="readonly"/>
						<input id="wpid" name="wpid" type="hidden" style="min-height: 24px;"  value="${(m.wpid)!}" readonly="readonly"/>
						
						</#list>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">退货数量:</label>
					<div class="controls">
					
						<input id="cksl" name="cksl" type="text"
							class="  easyui-numberbox "
							style="min-height: 24px;" />
					</div>
				</div>
			</div>
			<div class="span12 center">
				<a class="btn btn-info btn-small" onclick="saveModel()">确定 </a>
				&nbsp; &nbsp;&nbsp;&nbsp; 
				<a href="#" class="btn btn-danger btn-small bigger-110" onclick="parent.closeDialog();">取消 </a>
			</div>
		</form>

	</div>
</div>

</body>

<script>
	
</script>
</@layout>
